import { ref, onMounted } from "vue";

export default function () {
  let x = ref(0);
  let y = ref(0);
  // 获取鼠标的位置及其显示
  function clickFn(e: MouseEvent) {
    x.value = e.clientX;
    y.value = e.clientY;
  }
  // 挂载完成
  onMounted(() => {
    // 给文档绑定鼠标事件
    document.addEventListener("click", clickFn);
  });
  return {x,y}
};
